package com.cskaoyan.javase.oop1._3memory;

/**
 * 三个对象的内存图，其中有两个引用指向同一个对象
 * @since 10:14
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo {
    public static void main(String[] args) {
        Phone p = new Phone();
        p.brand = "华为";
        p.name = "Mate50";
        p.price = 5000;

        Phone p2 = p;
        Phone p3 = new Phone();


        System.out.println(p == p2);
        System.out.println(p == p3);
    }
}

class Phone {
    double price;
    String name;
    String brand;


    public void call() {
        System.out.println("打微信电话~");
    }

    public void play() {
        System.out.println("这个手机是" + price + "块钱买的,刷抖音很快~");
    }
}